import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: HomeView,
      redirect: '/login',
      children: [
        // 首页
        {
          path: 'home',
          name: 'home',
          component: () => import('../views/home/homeView.vue')
        },
        // 作品管理
        // 作品分类
        {
          path: 'works/category',
          name: 'category',
          component: () => import('../views/works/categoryView.vue')
        },
        // 作品管理
        {
          path: 'works/management',
          name: 'management',
          component: () => import('../views/works/managementView.vue')
        },
        // 幻灯片管理
        {
          path: 'banner',
          name: 'banner',
          component: () => import('../views/banners/bannerView.vue')
        },
        // 读者管理
        {
          path: 'reader',
          name: 'reader',
          component: () => import('../views/readers/readerView.vue')
        },
        // 举报管理
        // 举报书籍
        {
          path: 'reports/reportBook',
          name: 'reportBook',
          component: () => import('../views/reports/reportBookView.vue')
        },
        // 举报评论
        {
          path: 'reports/reportComment',
          name: 'reportComment',
          component: () => import('../views/reports/reportCommentView.vue')
        },
        // 订单管理
        // 币券订单管理
        {
          path: 'orders/orderCoin',
          name: 'orderCoin',
          component: () => import('../views/orders/orderCoinView.vue')
        },
        // 会员订单管理
        {
          path: 'orders/orderVip',
          name: 'orderVip',
          component: () => import('../views/orders/orderVipView.vue')
        },
        // 商品管理
        {
          path: 'product',
          name: 'product',
          component: () => import('../views/products/productView.vue')
        },
         // 作者管理
         {
          path: 'author',
          name: 'author',
          component: () => import('../views/authors/authorView.vue')
        },
        // 提现管理
        {
          path: 'withdrawal',
          name: 'withdrawal',
          component: () => import('../views/withdrawals/withdrawalView.vue')
        },
        // 评论管理
        {
          path: 'comment',
          name: 'comment',
          component: () => import('../views/comments/commentView.vue')
        },
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
  ],
})

export default router
